package com.example.houtai.controller;


import com.example.houtai.service.EsService;
import com.example.houtai.service.ITbPremisesInfoService;
import com.org.dto.IdNamePair;
import com.org.dto.PreDto;
import com.org.vo.ResultEntity;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 楼盘信息表 前端控制器
 * </p>
 *
 * @author 龚梦
 * @since 2021-03-26
 */
@Slf4j
@RestController
@RequestMapping("/sys/pre")
public class TbPremisesInfoController {

    @Autowired
    private EsService esService;

    @Autowired
    private ITbPremisesInfoService premisesInfoService;

    @RequestMapping("getSubwayList")
    public List<IdNamePair> subwayList(Integer city){
        log.info("city:"+city);
        return esService.subwayList(city);
    }

    @RequestMapping("businessCircleList")
    public List<IdNamePair> businessCircleList(Integer country){
        log.info("country:"+country);
        return esService.businessCircleList(country);
    }

    @RequestMapping("insert")
    public ResultEntity insert(@RequestBody PreDto preDto){
        return premisesInfoService.insert(preDto);
    }


    @RequestMapping("listAll")
    public ResultEntity listAll(@RequestBody PreDto preDto){
        return premisesInfoService.listAll(preDto);
    }


    @RequestMapping("getlistAll")
    public ResultEntity getlistAll(@RequestBody PreDto preDto){
        return premisesInfoService.getlistAll(preDto);
    }
}
